1 : <?php
2 : /*--------------------------------------------------------------------------+
3 : This file is part of eStudy.
4 : common/classes/class.format.inc.php
5 : - Modulgruppe: Framework
6 : - Beschreibung: Klasse zur Kapselung von Email-Funktionalität.
7 : - Version: 0.0.1, 16/09/04
8 : - Autor(en): George Parks Davie <killerg@gmx.net>
9 : Sebastian Walisko <sebastian@walisko.org>
10 : +---------------------------------------------------------------------------+
11 : This program is free software; you can redistribute it and/or
12 : modify it under the terms of the GNU General Public License
13 : as published by the Free Software Foundation; either version 2
14 : of the License, or any later version.
15 : +---------------------------------------------------------------------------+
16 : This program is distributed in the hope that it will be useful,
17 : but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : GNU General Public License for more details.
20 : You should have received a copy of the GNU General Public License
21 : along with this program; if not, write to the Free Software
22 : Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 : +--------------------------------------------------------------------------*/
24 : /**
25 : * Diverse Funktionen zum formatieren ausgeben
26 : * @package eStudy.Framework
27 : * @subpackage Mailsystem
28 : * @author George Parks Davie <killerg@gmx.net>
29 : * @author Sebastian Walisko <sebastian@walisko.org>
30 : * @version 0.0.1, 16/09/04
31 : */
32 : class Format {
33 : /**
34 : * Gibt einen formatierten Datums String zurueck mit Uhrzeit angabe
35 : *
36 : * @access public
37 : * @param [int] Unix Timestamp
38 : * @returns string
39 : */
40 : function UTS2HTMLext($myTime) {
41 0 : if ($myTime == 0) return "-";
42 0 : else return Output::echoDate("d.m.Y", (int)$myTime) ." <small>".Output::echoDate("H:i", (int)$myTime) ."h</small>";
43 : }
44 : /**
45 : * Gibt einen formatierten Datums String zurueck ohne Uhrzeit angabe
46 : *
47 : * @access public
48 : * @param [int] Unix Timestamp
49 : * @returns string
50 : */
51 : function UTS2HTML($myTime) {
52 0 : if ($myTime == 0) return "-";
53 0 : else return Output::echoDate("d.m.Y", (int)$myTime);
54 : }
55 : /**
56 : * gibt den link zur User Homepage als html string zurueck
57 : *
58 : * @access public
59 : * @param [int] userID
60 : * @param [string] Link Text; Standart steht auf "" fuer "Haus" Grafik als Link
61 : * @param [bool] flag fuer global oder Kurs spezifisch! 0=global; 1=kurs
62 : * @returns string
63 : */
64 : function Link2UserHP($userID, $linktext = "", $globalFlag) {
65 0 : $LinkStr = PATH_TO_ROOT."user/homepage.php?user=".$userID;
66 0 : if (trim($linktext) == "") $ReturnStr = "<a href='".$LinkStr."' title='Gehe zur Benutzer-Homepage'><img src='".PATH_TO_ROOT."images/link2profil.png' alt='Link zur Userhomepage' /></a>";
67 0 : else $ReturnStr = "<a href='".$LinkStr."' title='Gehe zur Benutzer-Homepage'>$linktext</a>";
68 0 : return $ReturnStr;
69 : }
70 : /**
71 : * wandelt die filesize (int) in bytes zu einem string in bytes, kb oder mb (je nach groesse)
72 : *
73 : * @access public
74 : * @param [long] gibt die Dateigroesse in byte an
75 : * @returns string
76 : */
77 : function FilesizeStr($filesize) {
78 0 : if ($filesize == 0) return "0 Byte";
79 : else {
80 0 : $total_size = $filesize;
81 0 : if ($total_size > 1048576) $total_size = floor($total_size/1048576) ." MB";
82 0 : elseif ($total_size > 1024) $total_size = floor($total_size/1024) ." KB";
83 0 : else $total_size = $total_size." Byte";
84 : }
85 0 : return $total_size;
86 : }
87 : }
|